package com.maple.blog.bean;

import java.beans.ConstructorProperties;

/**
 * 描述: com.maple.blog.bean
 *
 * @author hz.lei
 * @date 2018年04月27日 下午11:29
 */
public class ResponseBean {

    private int code;
    private String message;
    private Object data;

    public static ResponseBean success(Object object) {
        return new ResponseBean(0, "success", object);
    }

    public static ResponseBean error(Exception exception) {
        return new ResponseBean(-1, "error", exception.getMessage());
    }

    public int getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    public Object getData() {
        return this.data;
    }

    public void setCode(final int code) {
        this.code = code;
    }

    public void setMessage(final String message) {
        this.message = message;
    }

    public void setData(final Object data) {
        this.data = data;
    }


    @ConstructorProperties({"code", "message", "data"})
    public ResponseBean(final int code, final String message, final Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

}
